﻿using Health.Code;
using Health.Domain;
using Health.Infrastructure.Interface;
using Health.WebAPI.Wirte.Applicant.Command;
using MediatR;
using System.Security;

namespace Health.WebAPI.Wirte.Applicant.CommandHandler
{
    /// <summary>
    /// 反填咨询信息
    /// </summary>
    public class FantianCommandHandler : IRequestHandler<FantianCommand, APIRestl<List<Column>>>
    {
        IBaseRepository<Column> columnRep;

        public FantianCommandHandler(IBaseRepository<Column> columnRep)
        {
            this.columnRep = columnRep;
        }

        public Task<APIRestl<List<Column>>> Handle(FantianCommand request, CancellationToken cancellationToken)
        {
            APIRestl<List<Column>> restl = new APIRestl<List<Column>>();
            restl.code = APIEnum.显示成功;
            restl.mes = APIEnum.显示成功.ToString();

            var list=columnRep.GetAll().Where(s=>s.ColumnId == request.ColumnId).ToList();

            restl.data = list;

            return Task.FromResult(restl);
        }
    }
}
